package czp.handlertest2;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;

public class HandlerTest2 extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		System.out.println("Activity --> " + Thread.currentThread().getId());
		HandlerThread handlerThread = new HandlerThread("handler_thread");
		handlerThread.start();
		MyHandler myHandler = new MyHandler(handlerThread.getLooper());
		Message msg = myHandler.obtainMessage();
		System.out.println("11111111111");
		msg.sendToTarget();
	}
	
	class MyHandler extends Handler {
		public MyHandler() {
		}
		public MyHandler(Looper looper) {
			super(looper);
		}
		@Override
		public void handleMessage(Message msg) {
			super.handleMessage(msg);
			System.out.println("Handler --> " + Thread.currentThread().getId());
			System.out.println("handlerMessage");
		}
		
		
	}
	
}
